<template>
	<view class="form_box">
		<form>
			<label for="name">游玩计划名称:</label>
			<input type="text" id="planName" v-model="planName">
		</form>
		<button class="btn" type="button" @click="hitbtn">提交</button>
	</view>
</template>

<script>
export default {
	data() {
		return {
			planName: ''
		};
	},
	methods: {
		async hitbtn() {
			let upform = {
				name: this.planName,
				userid: uni.getStorageSync('userid'),
				nickname: uni.getStorageSync('nickname'),
			}
			if (this.planName == '') {
				uni.showToast({
					title: '请输入游玩计划名称',
					icon: 'none'
				});
				return
			}
			let res = await this.$api.addywjh(upform)
			console.log('%c [ res ]-34', 'font-size:13px; background:pink; color:#bf2c9f;', res)
			if (res.code == 0) {
				uni.showToast({
					title: '添加成功',
					icon: 'none'
				});
				setTimeout(() => {
					uni.navigateBack({ delta: 1 })
				}, 500);
			}
		}

	},
}
</script>

<style lang="scss">
.form_box {
	width: 100vw;
	height: 100vh;
	background: linear-gradient(#f5f7fa 0%, #58CFA6 100%);
	padding: 10px;
}

input {
	width: 100%;
	height: 40px;
	border: 1px solid #ccc;
	border-radius: 5px;
	padding: 0 10px;
	margin-top: 10px;
}

.btn {
	width: 100%;
	height: 40px;
	line-height: 40px;
	border: 1px solid #ccc;
	border-radius: 5px;
	padding: 0 10px;
	margin-top: 10px;
	background: #fff;
}
</style>